import Vue from 'vue'
import VueRouter from "vue-router";

import Layout from "@/views/Layout";
import Article from "@/views/Article";
import Collect from "@/views/Collect";
import Like from "@/views/Like";
import User from "@/views/User";
import ArticleDetail from "@/views/ArticleDetail";
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {name: 'LayoutPage', path: '/', redirect: '/article', component: Layout, children: [
        {path: '/article', component: Article},
        {path: '/collect', component: Collect},
        {path: '/like', component: Like},
        {path: '/user', component: User},
        //    动态路由传参，也就是路径参数；
        // {name: 'detail', path: '/article/detail/:id', component: ArticleDetail},
        //    查询参数传参则不需要后面的 /:id
        {name: 'detail', path: '/article/detail', component: ArticleDetail},
      ]
    },
  ]
})

export default router